<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="text" class="text">
  <button class="btn">添加</button>
  <ul class="list">
    <li>香蕉</li>
    <li>苹果</li>
    <li>鸭梨</li>
  </ul>
  <script>
    var oText = document.querySelector(".text");
    var oBtn = document.querySelector(".btn");
    var oList = document.querySelector(".list");
    oBtn.onclick = function(){
      var text = oText.value;
      var oLi = document.createElement("li");
      oLi.innerHTML = text;
      oList.appendChild(oLi);
    }
  </script>
</body>
</html>